<template>
	<view class="function-box">
		<view :class="['function-item',item.text == '油枪管理' ? 'sole-item' : '']" v-for="(item,i) in funcData" :key="i" @click="onClickToPage(item.path)">
			<image :src="item.icon" mode="widthFix"></image>
			<view>{{ item.text }}</view>
		</view>
	</view>
</template>

<script>
	import {
		reactive,
		toRefs,
		watchEffect
	} from 'vue'
	export default {
		props: {
			funcData: {
				type: Array,
				default: () => [],
			}
		},
		setup(props, ctx) {
			const data = reactive({
				funcDatas: props.funcData
			})
			watchEffect(() => {
				data.funcDatas = props.funcData
			})
			const onClickToPage = (path) => {
				ctx.emit('onClickTo', path)
			}
			return {
				...toRefs(data),
				onClickToPage
			}
		}
	}
</script>

<style lang="less">
	.function-box {
		display: flex;
		flex-wrap: wrap;
		width: 100%;
		padding: 0 20rpx;
		box-sizing: border-box;

		.function-item {
			display: flex;
			flex-wrap: wrap;
			justify-content: center;
			width: 31%;
			height: 220rpx;
			margin-top: 20rpx;
			margin-left: 22rpx;
			box-shadow: 0 0 12rpx 0 rgba(0, 0, 0, .1);
			border-radius: 20rpx;

			&:nth-child(3n+1) {
				margin-left: 4rpx;
			}
			image {
				width: 110rpx;
				margin-top: 20rpx;
			}

			view {
				text-align: center;
				font-size: 30rpx;
			}
		}
		.sole-item {
			image {
				width: 200rpx;
			}
		}
	}
</style>